package com.qf.ssm.controller.advice;

import com.qf.ssm.dot.Result;
import com.qf.ssm.exception.StudentIsEmptyException;
import com.qf.ssm.exception.StudentMsgException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 王博康
 * @version 1.0
 * @project 07_ssm
 * @description: TODO
 * @date 2022/3/10 21:52 星期四
 */
@RestControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler({StudentMsgException.class, StudentIsEmptyException.class})
    public Result disposeStudentException(StudentMsgException exception){
        return Result.setError(exception.getCode(),exception.getMessage() ,null );
    }
}
